﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using System.Data;

namespace WebsiteAdmin.Salomon.AboutUs
{
    public partial class ArticleList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dtNotes = Bll.Notes.MULTIPLE(Global.ConSalomon);

                if (dtNotes.Rows.Count > 0)
                {
                    RP_Notes.DataSource = dtNotes.DefaultView;
                    RP_Notes.DataBind();
                }

                dtNotes.Dispose();
            }
            else
            {
                Response.Redirect("/Trace.aspx?Err=1");
            }
        }

        protected void RP_Notes_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            // Execute the following logic for Items and Alternating Items.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // 找到分类Repeater关联的数据项
                DataRowView rowv = (DataRowView)e.Item.DataItem;

                Image isDisplay = ((Image)e.Item.FindControl("IsDisplayImage"));
                if (Convert.ToBoolean(rowv["IsDisplay"], CultureInfo.InvariantCulture) == true)
                {
                    isDisplay.ImageUrl = "/Images/Valid.Pass.gif";
                    isDisplay.AlternateText = "显示";
                }
                else
                {
                    isDisplay.ImageUrl = "/Images/Valid.Wrong.gif";
                    isDisplay.AlternateText = "隐藏";
                }

                Image isFoot = ((Image)e.Item.FindControl("IsFootImage"));

                if (Convert.ToBoolean(rowv["IsFoot"], CultureInfo.InvariantCulture) == true)
                {
                    isFoot.ImageUrl = "/Images/Valid.Pass.gif";
                    isFoot.AlternateText = "显示";
                }
                else
                {
                    isFoot.ImageUrl = "/Images/Valid.Wrong.gif";
                    isFoot.AlternateText = "隐藏";
                }

            }
        }

    }
}
